<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>期刊管理-发布期刊</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<link href="css/space.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/space.js"></script>
<script type="text/javascript" src="js/jquery-1.9.1.js"></script>
<script type="text/javascript">
$(function(){
	$.ajaxSetup({ cashe:false });
});

$(function(){
	$.get("json/findByEditorId", {value:"0"}, function(data) {
<%--		var obj = eval("(" + data + ")");--%>
		var html = "";
		for(var i=0;i<data.periodicals.length;i++){
			html += "<option value='"+data.periodicals[i].periodicalId+"'>"+data.periodicals[i].name+"</option>";
		}
		$("#periodical").append(html); 
	});
});

$(function(){
	$("#periodical").change(function(){
		$.post("perPeriodical/findPerPeriodicalArticle", { value:$("#periodical option:selected").attr("value") }, function(data){
			data = jQuery.parseJSON(data);
			if(data == ""){
				$("#emptyInfo").html("还没有会员向该期刊投文章，现在不能发布期刊！");
				$("#periodicalSubmit").attr("disabled","disabled");
			}else{
				var html = "";
				for(var i=0; i<data.length; i++) {
					html += "<tr height='30px'><td colspan='2'>" + data[i].bname + "</td></tr>";
					for(var j=0; j<data[i].articals.length; j++) {
						html += "<tr height='25px;'><td>" + data[i].articals[j].title + "</td><td>" + data[i].articals[j].pubDate + "</td></tr>";
					}
				}
				$("#perPeriodicalId").attr("value", data[0].perPeriodicalId);
				$("#number").attr("value", data[0].ppnumber);
				$("#article").append(html);
			}
		});
		}
	);
});
</script>

</head>
<body>
	<div class="all">
		<div class="bodyge-left">
			<div class="bodyge-left-a1"><span class="font-b">发布期刊</span></div>
			<form action="perPeriodical/publishPerPeriodical" method="post">
			<input type="hidden" id="perPeriodicalId" name="perPeriodical.perPeriodicalId" value="" />
			<input type="hidden" id="number" name="perPeriodical.number" />
			
			<table class="ma-tab" cellspacing="0px" cellpadding="0px">
				<tr height="30px">
					<td width="80px">期&nbsp;&nbsp;&nbsp;&nbsp;刊：</td>
					<td>
						<select id="periodical" name="perPeriodical.periodicalId">
							<option value="0">请选择期刊</option>
						</select>
					</td>
				<tr height="30px">
					<td>关键字：</td>
					<td><input type="text" name="perPeriodical.keywords" value="说明：关键字之间请用空格隔开" style="width:400px;" /></td>
				</tr>
				<tr height="30px">
					<td valign="top">简&nbsp;&nbsp;&nbsp;&nbsp;介：</td>
					<td><input type="text" id="keywords" onblur="chiefVali('keywords')" onclick="commentContent()" class="commentContent_1" name="perPeriodical.keywords" value="说明：关键字之间请用空格隔开" style="width:400px; font-size:13px;" /></td>
				</tr>
				<tr height="30px">
					<td colspan="2">文&nbsp;&nbsp;&nbsp;&nbsp;章：<span style="margin-left:30px;color:red;font-size:13px;font-style:italic;" id="emptyInfo">${ value }</span><br />
						<table id="article" class="ma-tab" cellspacing="0px" cellpadding="0px"></table>
					</td>
				</tr>
				<tr height="30px"></tr>
				<tr>
					<td colspan="2" align="center">
						<input type="submit" id="periodicalSubmit" class="inputStyle" value="提交" />
						&nbsp;&nbsp;&nbsp;&nbsp;
						<input type="button" onclick="window.history.go(-1)" class="inputStyle" value="返回" />
					</td>
				</tr>
			</table>
			</form>
		</div>
	</div>
</body>
</html>
